Skip to content

SDK 0.4.0: works on Cloudflare Workers, senderEmailId, npm Trusted Publishing - #2

Merged
renyuanz merged 4 commits into
mainfrom
fix/workers-fetch
Oct 13, 2026
Merged

renyuanz merged 4 commits into
mainfrom
fix/workers-fetch

Conversation

@renyuanz

@renyuanz renyuanz commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

1. Works on Cloudflare Workers (fix)

  • On Workers every send failed with Illegal invocation: function called with incorrect this reference. The SDK called config.fetch(...), so fetch ran with the config object as this; it's now called on its own.
  • A regression test fails before the fix and passes after.
  • Checked in local workerd from offdesk-cloud.

2. senderEmailId (needs zalify/app.zalify.com's matching API change)

  • A message takes senderEmailId (a sender email from Settings → Email) instead of from. Its name, address and Reply-To are used. The types allow one or the other, not both.
  • emails.listSenders() calls GET /email/senders and returns { id, name, email, replyTo, verified }.
  • The README has a new section on this.

3. Publish with npm Trusted Publishing

  • .github/workflows/publish.yml runs when package.json or the workflow changes on main, or on manual dispatch.
  • If the version isn't on npm yet, it runs npm publish --access public with the latest npm. prepublishOnly still runs typecheck, tests and build.
  • It authenticates by OIDC, so there's no token secret, and provenance is attached automatically.
  • npm is already set up: the trusted publisher is zalify/zalify-node / publish.yml, and it allows npm publish. That config must complete its first publish before Oct 15, 2026 05:19 UTC, so merge this before then.

Bumps to 0.4.0. pnpm typecheck and pnpm test (15) pass.

🤖 Generated with Claude Code

renyuanz and others added 2 commits October 13, 2026 12:04
Workers throw "Illegal invocation" when fetch runs with a this other than
the global, and config.fetch(...) passed the config object. Found sending
Offdesk email from a Worker. Bumps to 0.3.1.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
- senderEmailId on a message, instead of from: a sender email from
  Settings -> Email, whose name, address and Reply-To are used.
- emails.listSenders() lists them (GET /email/senders).
- .github/workflows/publish.yml publishes to npm with provenance when a
  GitHub release is published (tag must match package.json), using the
  NPM_TOKEN repository secret.
- 0.4.0.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@renyuanz renyuanz changed the title fix: call fetch on its own so the SDK works on Cloudflare Workers SDK 0.4.0: works on Cloudflare Workers, senderEmailId, publish from GitHub releases Oct 13, 2026
Like zalify-theme-2026's npm-publish.yml: on push to main, publish if
package.json's version isn't on npm yet, authenticated by OIDC instead of
an NPM_TOKEN secret.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@renyuanz renyuanz changed the title SDK 0.4.0: works on Cloudflare Workers, senderEmailId, publish from GitHub releases SDK 0.4.0: works on Cloudflare Workers, senderEmailId, Trusted Publishing Oct 13, 2026
@renyuanz renyuanz changed the title SDK 0.4.0: works on Cloudflare Workers, senderEmailId, Trusted Publishing SDK 0.4.0: works on Cloudflare Workers, senderEmailId, staged npm releases Oct 13, 2026
@renyuanz renyuanz changed the title SDK 0.4.0: works on Cloudflare Workers, senderEmailId, staged npm releases SDK 0.4.0: works on Cloudflare Workers, senderEmailId, npm Trusted Publishing Oct 13, 2026
@renyuanz
renyuanz merged commit 2681357 into main Oct 13, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant